#include "StdAfx.h"
#include "ClientConnection.h"
#include "FileDB.h"

using namespace seven;

ClientConnection::ClientConnection(QObject *parent)
	: Connection(parent)
{
	SetSocket(new QTcpSocket(this));
	connect(GetSocket(), SIGNAL(hostFound()), this, SLOT(hostFound()));
	connect(GetSocket(), SIGNAL(hostFound()), this, SLOT(connected()));
}

ClientConnection::~ClientConnection()
{

}


void ClientConnection::hostFound()
{
	Show("hostFound!");
}

void ClientConnection::connected()
{
	Show("connected!");
}

void ClientConnection::Connect( const QString& host, const QString& port )
{
	if (GetSocket())
	{
		GetSocket()->abort();
		//! [7]
		GetSocket()->connectToHost(host,port.toInt());		
	}
}
